color swatch: Fix up rendering
authorMatthias Clasen <mclasen@redhat.com>
Thu, 7 Jan 2016 23:38:31 +0000 (18:38 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 7 Jan 2016 23:38:31 +0000 (18:38 -0500)
gtk_render_content_path is expecting the full box dimensions,
not just the content area. So, add the border before calling it.

Note it is still possible to have some separation between the
color and the border, by setting padding.

gtk/gtkcolorswatch.c

index 4f31f6ebad76176be1799a0f0b88a92e68a623e7..6f574940d3e0cc876884e2ef992ec737fa741e71 100644 (file)
@@ -119,8 +119,14 @@ gtk_color_swatch_render (GtkCssGadget *gadget,
     {
       cairo_pattern_t *pattern;
       cairo_matrix_t matrix;
-
-      gtk_render_content_path (context, cr, x, y, width, height);
+      GtkBorder border;
+
+      gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
+      gtk_render_content_path (context, cr,
+                               x - border.left,
+                               y - border.top,
+                               width + border.left + border.right,
+                               height + border.top + border.bottom);
 
       if (swatch->priv->use_alpha)
         {